package com.bw.utils.aliPay;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016102600766086";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCJy8C5JEHQH4pHJw5bx7AZitU60FEoz/w31rKHkNxRhoIYjV8T3zJI7uF6ZbgckVkebH9dOnkPfb40shERhs/llb5WzVLeWgWgxqfVOwDv9DU1mB+5gjtmEOsOH5siYnZ0Fs+m57dTwVixHNBApXnVgbgwQRs6JXEI3tJBxTOTTVKnHgEk0YOVovTyiOMI71pTM934G+7maoddm/EoLfOXvwzkGSFMitEAq6mfTlNl58ORJKqhazIprs8A1mO2g4pcI5pSTi9llrIR1kC5RcRyVBdkMrz3ReaklG3beJLJAbOKh7+gjv/I856aV+YAF73oPAZDQgBpa6s1X9zf6xINAgMBAAECggEAdZV823/o+SQw5w6Y3hDEYMdrtUhWOTFh1HRM3AntN1REZ5cbbuWjD0Fo/v0V4qrVFXUYKgHflCyExoq8rewQM6VYStHiyQKgktVyGi7DWf9V+GnbiH1tGmeNbPvjca/7zIw6nf5VHg97E4e23bNXB64t8l9cUH3qutsJKD6TCDpDVVl6Wf56ynT9syji79M95sRIFu7o/hZ0rWlcFk5c8NIzF5YR/mcQaEZGDR92QaQCwXfjasY62U4ImUFOJGjjTQNh2YsBcMYEnZDUSu/6e9JSpQozAbO3sl2Ua55NMgknrK6TvyGqsLBFBTyxCjIJXBxx9pnNUTXsMSdp6m2esQKBgQD0y9hx1AjBQLEmZcDE88150LGN/4HogIBZ96TH8vYPvqQigLsmgSxQ3ZEWyJiBrTZUc2XwEhD6FbRaa9Xsrh2m3FxDNzVCdtjbaYeEPHMHBXneKSm0cge/8q6FruLT20PXD7PrzZagfUbbCoY+G4Xc639SrGYIfdHka4+Lc1TzXwKBgQCQGjzv2e0xi7/Dapo0DU3Cb0Xf2+6QsXd3oUOZyGMt/cROl/yBW0kLxsm4x+061l040Y+cksmKM/st2gFwLUL4xG5WeqNSSFZusSUbnK6uEEVBfdi/hEc1XtXkB84MDR19T7bNoJdkIxp5Ffj+q/UyiF1+0pbiD+CdGXK8rdQ+EwKBgQDH9GoMMIImOM1668qWFf9U7V7a+kYGwFAXLO1wVckf+zze4f/8565nL1SAI8JOykmCmfA+NMOhQ3FaGpNXDLIzxfOnA8WBUMq6Dm0fWrEqnxJ4oW7rcelapMRhdgTZwFSdqrnwdrH+zdW+vc4BlUG2vrX1tdRyQzPbPPC3m7FcSQKBgH0QKH7JlhAAB2fkJvyx5yCuTehhCgVN4C9VKERZI6qQqUTEp4Lk5NpxpjTWXs9HqBRd29O5mWx2fLJomALxZURdxp0LRp9s5Iag+2GhdADhYhnazLg6Z0qsidmj5HGVGFjfS/nePEXOKXWZWkY8m0tGCk69GfIMcZYmteuGucM9AoGBAOV9dQuQNUpTQ/EEt90wlF9TDzamcb3qYrdFL4u4oX55vNo9PF+1514ixzsiZrFEQRY3p/dXic5tKcAM3TdEsWBkGJi4p3RY88Y4t7WrY3x0RcTEc00OsJPw3FLAGjvC0Qgg2Pr+tCPcXkdtslq3oxWjVyOu0iUHsFBgoN/brNPA";
    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkEzEmSfFXZx+J6SL4p0U+l60rVX5QntJlNoce8t3NLDRjG5t3DwjOJo21pmxD6bqpmngUFSKJR8Y0DiJbKALG3ANeU9TUqUWLAgmC+YQD1F3LsAXmXDDZ5wg0u9H+dRKGZT3l1/Yfh2tDFY5Tpe7V9sX/8Cn1WR2EEW/3PghR2fnyOUl7PSyF0gvH5do5JRLxkKTDkT1BVUc1LdXxRYkLjkIUGqakg5zvT7uFR4KVzmCd4WpQZno6ztouvbAQboF7oxEbXfPQ8Esycz2B8L9eZa5grLLZM0hp1JJX9w/C790BuwReRppAAJu/gyBJXkQqlRS/5E85EUL9L/RRfYXQQIDAQAB";
    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8080/payLog/checkNotify";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost:8888/#/payReturn";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}


